﻿//
// Created by Administrator on 2025/7/4.
//
#include <iostream>
using namespace std;
class Base {
public:
    virtual ~Base() {
        std::cout << "Base destructor" << std::endl;
    }
};

class Derived : public Base {
public:
    ~Derived() {
        std::cout << "Derived destructor" << std::endl;
    }
};

int main() {
    Base* p = new Derived();
    delete p; // 会先调用 Derived 析构，再调用 Base 析构
}
